﻿{include file="public/header" /}
<title>管理员管理</title>
</head>

<body>
	<article class="page-container">
		<form class="form form-horizontal" id="form-admin-add" method="post">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所属父级：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<span class="select-box">
				  <select class="select" size="1" name="pid" id="pid">
				    <option value="0" selected>选择所属父级</option>
				    {foreach name="store_menu_level_list" item="vo"}
					<option value="{$vo.id}">{neq name="vo.level" value="1"}|{php}for($i=1;$i<$vo['level'];$i++){echo ' ----';}{/php}{/neq}{$vo.name}</option>
					{/foreach}
				  </select>
				</span>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单名称：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="" placeholder="菜单名称" id="name" name="name">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>节点URl：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="" placeholder="如：admin/user/adduser (一级节点添加“#”即可)" id="title" name="title">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">CSS样式：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="" placeholder="图标,&#xe62d;" id="icon" name="icon">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">排 序：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="" placeholder="排 序,数字" id="sort" name="sort">
				</div>
			</div>
			<div class="row cl">

				<label class="form-label col-xs-4 col-sm-3">状  态：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<div class="radio-box">
						<input type="radio" value="1" name="status" id="status" checked>
						<label for="radio-2">显示</label>
						<input type="radio" value="2" name="status" id="status">
						<label for="radio-2">隐藏</label>
					</div>
				</div>
			</div>

			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary radius" id='tijiao' type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>
	{include file="public/footer" /}
	<script type="text/javascript">
		$(function() {
			$('.skin-minimal input').iCheck({
				checkboxClass: 'icheckbox-blue',
				radioClass: 'iradio-blue',
				increaseArea: '20%'
			});

			$('#tijiao').click(function() {
				$.ajax({
					type: 'post',
					data: {
						pid: $('#pid').val(),
						name: $('#name').val(),
						title: $('#title').val(),
						icon: $('#icon').val(),
						sort: $('#sort').val(),
						status: $('input:radio:checked').val()
					},
					url: "{:url('users/admin_permission_add')}",
					success: function(data) {
						if(data.code == 200) {
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							}, function() {
								window.parent.location.reload();
								var index = parent.layer.getFrameIndex(window.name);
								parent.layer.close(index);
							});
						} else {
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							});
						}

					},
					error: function(XmlHttpRequest, textStatus, errorThrown) {
						layer.msg(data.msg, {
							icon: 1,
							time: 1000
						});
					}
				});
			});

		});
	</script>